<?php
	require_once( '../constants/lib_paths.php' );
	session_start();
	// Get file extension
	function getExt($filename) {
		return substr(strchr($filename, '.'), 1);
	}
	
	$data = array();
	$dir = "../users/".$_SESSION['username']."/". $_GET['folder'];
	$files = scandir($dir);
	foreach($files as $file) {
		$f = $dir.'/'.$file;
		if(!is_dir($file)) {
			$data[] = array($file, date('d-m-y', filemtime($f)), getExt($file), $f);
		}
	}
	echo json_encode($data);
?>
